package com.example.easyexcel.imports.dtos;


import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.example.easyexcel.converters.BoolEnumConverter;
import com.example.easyexcel.converters.GenderConverter;
import com.example.easyexcel.converters.LongStrConverter;
import com.example.easyexcel.enums.BoolEnum;
import com.example.easyexcel.exports.customized.comment.HeadComment;
import com.example.easyexcel.exports.customized.selected.ExcelSelected;
import com.example.easyexcel.exports.dtos.dynamicSelecteds.BooleanEnumSelected;
import com.example.easyexcel.exports.dtos.dynamicSelecteds.DbFieldSelected;
import lombok.Data;

import java.util.Date;

/**
 * 要导出、导入的对象
 * */
@Data
//@Accessors(chain = true)  // easyExcel 读取数据为空怎么办？ https://www.ngui.cc/el/1893591.html?action=onClick
public class ImportDataDTO {
    @ExcelProperty(value = "数字" /*,index=0 ,order = 0*/ ) // 索引>顺序>默认排序
    private long num;
    @ExcelProperty(value = "数字2" , converter = LongStrConverter.class)
    private Long num2;
    @ExcelProperty("字符串")
    private String str;
    @ExcelProperty("日期时间")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private Date dateTime;
    @ExcelProperty(value = "INT2STR", converter = GenderConverter.class)  // 关联‘GenderConverter’
    private int int2str;
    @ExcelProperty("布尔")
    private boolean boo;
    @ExcelProperty(value = "枚举", converter = BoolEnumConverter.class)  // 关联‘BoolEnumConverter’
    private BoolEnum enumer;

    @ExcelIgnore
    private String str_ignore;

    private String 字段_1;

    private String 字段_2;

    /////////////////////////////////////// 扩展支持操作
    //固定下拉框  （关联customized.selected ）
    @ExcelProperty(value = "下拉框-固定")
    @ExcelSelected(source = {"耗材","普通设备","医疗设备"})
    private String dropdownBox_fixed;
    //动态下拉框：可以查询数据库数据显示在下拉框中  （关联customized.selected ; 要定义‘dynamicSelect’）
    @ExcelProperty(value = "下拉框-数据库")
    @ExcelSelected(sourceClass = DbFieldSelected.class)
    private String dropdownBox_db;
    //动态下拉框：枚举数据显示在下拉框中  （关联customized.selected ; 要定义‘dynamicSelect’）
    @ExcelProperty(value = "下拉框-枚举", converter = BoolEnumConverter.class)
    @ExcelSelected(sourceClass = BooleanEnumSelected.class)
    private BoolEnum dropdownBox_enum;
    // 待批注的字段  （关联customized.comment ）
    @HeadComment("这个是批注内容。")
    @ExcelProperty(value = "批注字段" )
    private String commentField;
    // TODO
    @ExcelProperty(value = "图片" )
    private String imagePath;
}